package day240918;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
@WebServlet("/RequestServlet3")
public class RequestServlet3 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String method = req.getMethod();
        String contextPath = req.getContextPath();
        StringBuffer requestURL = req.getRequestURL();
        String requestURI = req.getRequestURI();
        String queryString = req.getQueryString();
        String header = req.getHeader("user-agent");

        resp.getWriter().write("method = " + method + System.lineSeparator() + "contextPath = " + contextPath + System.lineSeparator() + "requestURL = " + requestURL + System.lineSeparator() + "requestURI = " + requestURI + System.lineSeparator() + "queryString = " + queryString + System.lineSeparator() + "header = " + header);
    }
}
